package cn.com.haopy.yue.ai.db.service.hos.impl;


import cn.com.haopy.yue.ai.db.entity.arisk.AIRiskStandardCalculate;
import cn.com.haopy.yue.ai.db.mapper.arisk.AIRiskStandardCalculateMapper;
import cn.com.haopy.yue.ai.db.service.BaseServiceImpl;
import cn.com.haopy.yue.ai.db.service.hos.AIRiskStandardCalculateService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * @Description: TODO
 * @Author DuTao
 * @Date 2023/9/25 14:49
 */
@Service
@Slf4j
public class AIRiskStandardCalculateServiceImpl extends BaseServiceImpl<AIRiskStandardCalculateMapper, AIRiskStandardCalculate> implements AIRiskStandardCalculateService {

    @Override
    public AIRiskStandardCalculate getByChargeId(Integer chargeId, Integer cateId) {
        QueryWrapper<AIRiskStandardCalculate> queryWrapper = new QueryWrapper<>();
        if (Objects.nonNull(chargeId)) {
            queryWrapper.lambda().eq(AIRiskStandardCalculate::getChargeId, chargeId);
        }

        if (Objects.nonNull(cateId)) {
            queryWrapper.lambda().eq(AIRiskStandardCalculate::getCateId, cateId);
        }

        return super.getOne(queryWrapper);
    }

    @Override
    public List<AIRiskStandardCalculate> getListByChargeId(Integer chargeId) {
        QueryWrapper<AIRiskStandardCalculate> queryWrapper = new QueryWrapper<>();
        if (Objects.nonNull(chargeId)) {
            queryWrapper.lambda().eq(AIRiskStandardCalculate::getChargeId, chargeId);
        }

        return super.list(queryWrapper);
    }
}
